|
|
|
|
|
|
|
p-code is a hybrid of interpreted and compiled languages. A compiler compiles the source code, but it does not produce machine language. Instead, it produces a series of symbols for the source code. These symbols make a line of code that has five words into just one or two characters. When you run the program, a p-code interpreter interprets each line of the p-code, turning it into machine language. When p-code is executing, its faster than interpreted code because there are fewer characters to read; however, its still slower than compiled code. Visual Basic has the option of generating p-code or generating native code. |
|
|
|
|
|
|
|
|
Visual Basic also has the ability to generate native code EXE files. This can give you some significant enhancements in performance when doing CPU-intensive calculations. |
|
|
|
|
|
|
|
|
If you have a part of your program thats CPU bound (generating Mandelbrot sets, for example), you can compile that piece into native code. You might also want to write this piece as a C language DLL that you could call from Visual Basic. |
|
|
|
|
|
|
|
|
Which Option Should You Choose? |
|
|
|
|
|
|
|
|
When youre running a Windows program, much of the CPU time is used by Windows function calls or calls to external DLLs, not by the source code in your program. A lot of time is also spent waiting on the user to perform the next task, click the next button, or maybe type the next character. Therefore, Visual Basic p-code programs are generally fast enough for most business applications. |
|
|
|
|
|
|
|
|
Since the introduction of Visual Basic for Applications (VBA), Microsoft has positioned Visual Basic as the premier general-purpose Windows development tool. Its the glue for assembling software components into software solutions. All the Microsoft Office products now include Visual Basic as their macro/development language. Many third-party companies are licensing VBA so that their customers can program their products. Microsoft has also created a scripting edition of Visual Basic for Internet development both in the browser and on a Web server called VBScript. Visual Basics main competitors are Powersofts PowerBuilder, Borlands Delphi, and Microsofts own Visual C++, Access, and Visual FoxPro. Although these are all fine languages, none enjoys the success or widespread use that the Visual Basic language does. |
|
|
|
|
|